<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="imnu.edu.pojo.Student" %><%--
  Created by IntelliJ IDEA.
  User: lys
  Date: 2020/8/14
  Time: 14:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>EL表达式</title>
</head>
<body>
<%
    pageContext.setAttribute("stuName","zhangsan");
    request.setAttribute("stuName","lisi");
    session.setAttribute("stuName","wangwu");

    List<String> lst = new ArrayList<>();
    lst.add("zhaoliu");
    lst.add("tom");
    request.setAttribute("listName",lst);

    Map<String,Object> map = new HashMap<>();
    map.put("stuName","xiaoming");
    session.setAttribute("mapName",map);

    Student stu0 = new Student();
    stu0.setStuName("lily");
    stu0.setStuAge(21);
    session.setAttribute("stu",stu0);

%>

学生姓名：${stuName}
<br>
学生姓名(session)：${sessionScope.stuName}
<br>
el表达式读取集合list元素：${requestScope.listName[1]}
<br>
el表达式读取对象元素：${sessionScope.stu}
<br>
el表达式读取对象元素：${sessionScope.stu.stuAge}
<br>
el表达式读取对象元素：${sessionScope.stu["stuAge"]-5>18?"成年":"未成年"}
<br>
el表达式读取map元素：${sessionScope.mapName["stuName"]}
<br>

</body>
</html>
